package com.ruoyi.system.domain;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 商品评论对象 super_comment
 * 
 * @author xjf
 * @date 2025-08-13
 */
public class SuperComment extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 评论ID,自增 */
    @Excel(name = "评论ID,自增")
    private Long id;

    /** 用户ID */
    @Excel(name = "用户ID")
    private Long userId;
    /*这都是从表的内容"*/
    /*用户名称、商品名称*/
    private String userName;
    /*用户头像*/
    private String avatar;
    private String productName;
    // 新增：接收聚合的图片URL字符串（逗号分隔）
    private String imageUrls;
    // 新增：方便前端直接使用的图片URL列表（可选）
    private List<String> imageUrlList;

    /** 商品ID */
    @Excel(name = "商品ID")
    private Long productId;

    /** 订单ID */
    @Excel(name = "订单ID")
    private Long orderId;

    /** 评分 */
    @Excel(name = "评分")
    private Long rating;

    /** 评论内容 */
    @Excel(name = "评论内容")
    private String content;

    /** 评论时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8")
    @Excel(name = "评论时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date createdAt;

    /** 删除标志(0存在) */
    private Long del;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public String getImageUrls() {
        return imageUrls;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public void setImageUrls(String imageUrls) {
        this.imageUrls = imageUrls;
        // 自动将逗号分隔的字符串转为List（前端可直接使用）
        if (imageUrls != null && !imageUrls.isEmpty()) {
            this.imageUrlList = Arrays.asList(imageUrls.split(","));
        } else {
            this.imageUrlList = new ArrayList<>();
        }
    }

    public List<String> getImageUrlList() {
        return imageUrlList;
    }

    public void setImageUrlList(List<String> imageUrlList) {
        this.imageUrlList = imageUrlList;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public Long getId()
    {
        return id;
    }

    public void setUserId(Long userId) 
    {
        this.userId = userId;
    }

    public Long getUserId() 
    {
        return userId;
    }

    public void setProductId(Long productId) 
    {
        this.productId = productId;
    }

    public Long getProductId() 
    {
        return productId;
    }

    public void setOrderId(Long orderId) 
    {
        this.orderId = orderId;
    }

    public Long getOrderId() 
    {
        return orderId;
    }

    public void setRating(Long rating) 
    {
        this.rating = rating;
    }

    public Long getRating() 
    {
        return rating;
    }

    public void setContent(String content) 
    {
        this.content = content;
    }

    public String getContent() 
    {
        return content;
    }

    public void setCreatedAt(Date createdAt) 
    {
        this.createdAt = createdAt;
    }

    public Date getCreatedAt() 
    {
        return createdAt;
    }

    public void setDel(Long del) 
    {
        this.del = del;
    }

    public Long getDel() 
    {
        return del;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("userId", getUserId())
            .append("productId", getProductId())
            .append("orderId", getOrderId())
            .append("rating", getRating())
            .append("content", getContent())
            .append("createdAt", getCreatedAt())
            .append("del", getDel())
            .toString();
    }
}
